# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pylnk
pkgname=('python2-pylnk' 'python-pylnk')
_pkgname=pylnk
pkgver=0.2
pkgrel=10
pkgdesc='Windows LNK File Parser and Creator.'
arch=('any')
url='https://pypi.org/project/pylnk/#files'
license=('LGPL')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('cf85c25727171cf599d9bb3d441b7f3cef7081833901653397a62479217c8f7b2eb277ab90bef108d776bbd4ec36cbe1f11efbd7f1c09f03559f6c57272f6e35')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pylnk() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-pylnk() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

